package vn.mta.nht.mock.dao;

import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import vn.mta.nht.mock.entity.Premise;

/**
 * author:TruongNH.(nguyenhuutruong.20111991@gmail.com) created date: Dec 21,
 * 2014 version: 1.0
 */
public class PremiseDAOImpl extends HibernateDaoSupport implements PremiseDAO {

	public void save(Premise premise) throws Exception {
		getHibernateTemplate().save(premise);
	}

	public void update(Premise premise) throws Exception {
		getHibernateTemplate().update(premise);
	}

	public void delete(Premise premise) throws Exception {
		getHibernateTemplate().delete(premise);
	}

//	public Premise findByPremiseCode(int preId) throws Exception {
//		List<Premise> list = (List<Premise>) getHibernateTemplate().find("from Premise where preId=?", preId);
//		return (Premise) list.get(0);
//	}

	public List<Premise> findAll() {
		List<Premise> list = (List<Premise>) getHibernateTemplate().find("from Premise");
		return list;
	}

}
